#切片是list范围取值的一种方式
import string
# print(string.ascii_lowercase)
# print(string.ascii_uppercase)
# print(string.ascii_letters)
# print(string.digits)
# print(string.punctuation)

l = ['a','b','c','d']
# print(l[0:2]) #切片顾头不顾尾
# print(l[2:])#:后面不写数字,默认取到末尾
# print(l[:2])#:前面不写数字,默认从第一位开始取
# print(l[:])#不写数字,表示从头取到尾
# print(l[0:4:2])#2表示是步长
# print(l[::-1])#如果是负数,那么取值的时候从右往左取,
# print(l[-1:-4:-2])#同时你的开始和结束下标也要写成负数

# print(list(range(1,5)))#也是顾头不顾尾

# h = [0, 1, 2,2, 3, 4, 5, 6, 7, 8, 9]
# h2 = [0, 1, 2,2, 3, 4, 5, 6, 7, 8, 9]
# for i in h2:
#     if i%2==0:
#         h.remove(i)
# print(h)



#浅拷贝/深拷贝
h = [0, 1, 2,2, 3, 4, 5, 6, 7, 8, 9]
h2 = h#浅拷贝
for i in h2:
    if i%2==0:
        h.remove(i)
print(h)

import copy
h = [0, 1, 2,2, 3, 4, 5, 6, 7, 8, 9]
h2 = copy.deepcopy(h)#深拷贝,h赋值给h2
for i in h2:
    if i%2==0:
        h.remove(i)
print(h)
